﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RWLibrary.Logic.Graph
{
    /// <summary>
    /// Klucz dla polaczenia - zawiera nazwe, koszt akcji i hash celu
    /// </summary>
    public class Edge
    {
        public string Name { get; private set; }
        public int Cost { get; private set; }
        public State Destination { get; private set; }

        public Edge(string name, int cost, State destination)
        {
            this.Name = name;
            this.Cost = cost;
            this.Destination = destination;
        }

        public override string ToString()
        {
            return this.Name + " (" + this.Cost + ")";
        }

        public override bool Equals(object obj)
        {
            Edge e = obj as Edge;
            if (e == null) return false;
            return e.Name == this.Name && e.Cost == this.Cost && e.Destination.Equals(this.Destination);
        }

        public override int GetHashCode()
        {
            return 17 + 23 * this.Name.GetHashCode() + 23 * Cost + 23*Destination.GetHashCode();
        }
    }
}
